package org.zcl.rocketmq.service.impl;

import org.springframework.stereotype.Service;
import org.zcl.rocketmq.entity.Order;
import org.zcl.rocketmq.service.OrderService;

import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * .
 *
 * @author zhuchenglin
 * @since 2024/6/22 13:45
 */
@Service
public class OrderServiceImpl implements OrderService {

    public Map<String, Order> map = new HashMap<>();

    @PostConstruct
    public void init() {
        Order order = new Order();
        String orderId = "2024062201";
        order.setOrderId(orderId);
        order.setCreateTime(new Date());
        order.setPaidMoney(BigDecimal.valueOf(1000));
        map.put(orderId, order);
    }

    @Override
    public void addOrder(Order order) {

    }

    @Override
    public Order getById(String orderId) {
        return map.get(orderId);
    }

    @Override
    public void removeById(String orderId) {
        map.remove(orderId);
    }

}
